<?php
// 【最终完整版】oder.php

// 引入公共头部文件，它包含了页面的<head>和样式
require_once('common/header.php'); 
?>

<!-- 主体内容区域 -->
<div class="main-content">
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">我的订单</h3>
        </div>
        <div class="card-body">
            <!-- 搜索和筛选表单 -->
            <form id="filter-form" class="mb-3">
                <div class="input-group">
                    <span class="input-group-text bg-light border-0"><i class="bi bi-search"></i></span>
                    <input type="text" class="form-control border-0" name="keyword" placeholder="输入姓名、手机或订单号">
                    <button class="btn btn-primary" type="submit">搜索</button>
                </div>
            </form>
            
            <!-- 筛选开关 -->
            <div class="form-check form-switch mb-3">
                <input class="form-check-input" type="checkbox" role="switch" id="scope-switch">
                <label class="form-check-label" for="scope-switch">包含下级代理订单</label>
            </div>
            
            <!-- 订单卡片列表容器 -->
            <div id="order-list-container" class="order-list-container">
                <div class="text-center p-5">
                    <div class="spinner-border text-primary" role="status">
                        <span class="visually-hidden">Loading...</span>
                    </div>
                    <p class="mt-2 text-muted">正在加载订单...</p>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 订单详情模态框 -->
<div class="modal fade" id="orderDetailModal" tabindex="-1" aria-labelledby="orderDetailModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
    <div class="modal-content" style="border-radius: 12px;">
      <div class="modal-header">
        <h5 class="modal-title" id="orderDetailModalLabel">订单详情</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body" id="orderDetailModalBody">
        <!-- 详情内容将由JS动态填充 -->
      </div>
      <div class="modal-footer" style="border-top: none;">
        <button type="button" class="btn btn-primary w-100" data-bs-dismiss="modal">我知道了</button>
      </div>
    </div>
  </div>
</div>

<!-- 实名提示模态框 -->
<div class="modal fade" id="renameModal" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="renameModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content text-center">
      <div class="modal-body p-4">
        <i class="bi bi-exclamation-triangle-fill text-danger" style="font-size: 50px;"></i>
        <h4 class="text-danger mt-3">警告：账号未实名</h4>
        <p class="my-3">根据平台要求，您必须完成实名认证才能使用所有功能。</p>
        <a href="profile.php" class="btn btn-primary">立即前往实名</a>
      </div>
    </div>
  </div>
</div>


<?php 
// 引入公共底部文件，它包含了JS逻辑
require_once('common/footer.php'); 
?>